/*
 * Tmt.h
 * --------
 *
 * Author: Chris Lee <clee@mg8.org>
 * License: GPL v2 <http://www.opensource.org/licenses/gpl-license.php>
 */


#define TMT_WRITE_PERMS @"write"

#define API_KEY "f681cd22618e3904a46673a5f1994afe"
#define SHARED_SECRET "753fe515701a0d43"

#if !defined(API_KEY) || !defined(SHARED_SECRET)
#error "You need to define an API key and a shared secret. The MobileSmsutils API key is not contained in the source code."
#else
#define SMSUTILS_API_KEY @API_KEY
#define SMSUTILS_SHARED_SECRET @SHARED_SECRET
#endif

#define MIME_BOUNDARY "----16c17a9ea1d7b327e7489190e394d411----"
#define CONTENT_TYPE "multipart/form-data; boundary=" MIME_BOUNDARY

#import <Foundation/Foundation.h>

#import "TmtCategory.h"

@class MessageView;

@interface Tmt : NSObject
{
	MessageView *_messageview;
	NSUserDefaults *_settings;
	NSDictionary *_default_strings;
}

- (id)initWithMessageView: (MessageView *)messageview;

#pragma mark XML helper functions
- (NSArray *)getXMLNodesNamed: (NSString *)nodeName fromResponse: (NSData *)responseData;
- (NSDictionary *)getXMLNodesAndAttributesFromResponse: (NSData *)responseData;

#pragma mark internal functions
- (NSURL *)signedURL: (NSDictionary *)parameters withBase: (NSString *)base;
- (NSURL *)signedURL: (NSDictionary *)parameters;
- (NSURL *)authURL;
- (NSString *)frob;

#pragma mark externally-visible interface
- (BOOL)sendToGrantPermission;
- (BOOL)tradeFrobForToken;
- (BOOL)checkToken;
- (BOOL)postMessageWithMessage:(Message*)message;

@end
